package migrator

import (
	"mig/pkg/data"
	"mig/pkg/types"
)

const (
	falsePositiveProb = 1e-20
)

type BloomFilterMigrator struct {
	chunkSize  int64
	maxWorkers int
}

func NewBloomFilterMigrator(chunkSize int64, maxWorkers int) *BloomFilterMigrator {
	return &BloomFilterMigrator{
		chunkSize:  chunkSize,
		maxWorkers: maxWorkers,
	}
}

func (d *BloomFilterMigrator) Migrate(source data.Database, target data.Database, unequalChunks []types.UnequalChunk) (*types.IntegrityInfo, error) {
	digests, err := simpleMigrate(source, target, d.chunkSize, d.maxWorkers, unequalChunks)
	if err != nil {
		return nil, err
	}
	return types.NewBloomFilterIntegrityInfo(digests), nil
}
